﻿using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using KnifeZ.PersonalNotePad.Services;
using KnifeZ.PersonalNotePad.Views;
using KnifeZ.PersonalNotePad.Views.Auth;
using KnifeZ.PersonalNotePad.Models;
using KnifeZ.XamarinDomain;
using KnifeZ.XamarinDomain.Models;

namespace KnifeZ.PersonalNotePad
{
    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();
            //注册dataStore
            //DependencyService.Register<MockDataStore>();

            //MainPage = new MainPage();
            #region 判定登录
            DataContext.CreateOrUpdateAllTablesAsync();
            var it = DataContext.Instance.Table<TodoItem>().CountAsync().Result;
            if (it > 0)
            {
                MainPage = new MainPage();
            }
            else
            {

                MainPage = new Login();
            }
            #endregion
        }

        protected override void OnStart()
        {
        }

        protected override void OnSleep()
        {
        }

        protected override void OnResume()
        {
        }
    }
}
